import React from 'react';

export default class List extends React.Component{
  constructor(props){
    super(props)
  }
  render(){
    let data = this.props.todos;
    console.log(data);
    return(
      <div>
        <ul>
          {data.map((item,index)=>{
            return <li onClick={this.clickHandle.bind(this,item.id)} key={index}>{item.value}</li>
          })}
        </ul>
      </div>
    )
  }
  //直接在父组件中的函数中调用参数
  clickHandle(id){
    console.log(id);
    this.props.deleteFn(id)
  }
}